package com.mdd.usercenter.service;

import com.mdd.usercenter.model.domain.User;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mdd.usercenter.model.vo.UserVo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.List;

/**
* @author mdd
* @description 针对表【user(用户)】的数据库操作Service
* @createDate 2023-04-10 18:37:38
*/
public interface UserService extends IService<User> {


    /**
     * 用户注册
     *
     * @param userAccount   用户账户
     * @param userPassword  用户密码
     * @param checkPassword 校验密码
     * @param planetCode 星球编号
     * @return 新用户 id
     */
    long userRegister(String userAccount, String userPassword, String checkPassword, String planetCode);

    /**
     * 用户登录
     *
     * @param userAccount  用户账户
     * @param userPassword 用户密码
     * @param request
     * @return 脱敏后的用户信息
     */
    User userLogin(String userAccount, String userPassword, HttpServletRequest request);

    /**
     * 用户脱敏
     *
     * @param originUser
     * @return
     */
    User getSafetyUser(User originUser);

    /**
     * 用户注销
     *
     * @param request
     * @return
     */
    int userLogout(HttpServletRequest request);

    /**
     * 根据标签搜素用户
     * @param tags
     * @return
     */
    List<User> searchUserByTags(List<String> tags);

    /**
     * 更新用户信息
     */
    Integer updateUser(User user, User loginUser);

    /**
     * 获取登录用户
     * @param session
     * @return
     */
    User getLoginUser(HttpSession session);

    /**
     * 是否为管理员
     *
     * @param request
     * @return
     */
    boolean isAdmin(HttpServletRequest request);

    boolean isAdmin(User user);

    /**
     * 匹配相似用户
     * @param num
     * @param loginUser
     * @return
     */
    List<UserVo> matchUsers(long num, User loginUser);
}
